﻿#配置一些常用的工具

FROM ubuntu:16.04

MAINTAINER gao "g864069775@163.com"

#替换源
RUN echo 'deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse' > /etc/apt/sources.list && \ 
	echo 'deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse' >> /etc/apt/sources.list && \ 
	echo 'deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse' >> /etc/apt/sources.list && \
        echo 'deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted' >> /etc/apt/sources.list && \
        echo 'deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted' >> /etc/apt/sources.list && \
        echo 'deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial universe' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse' >> /etc/apt/sources.list && \
        echo 'deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties' >> /etc/apt/sources.list && \
        echo 'deb http://archive.canonical.com/ubuntu xenial partner' >> /etc/apt/sources.list && \
        echo 'deb-src http://archive.canonical.com/ubuntu xenial partner' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted' >> /etc/apt/sources.list && \
        echo 'deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe' >> /etc/apt/sources.list && \
        echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse' >> /etc/apt/sources.list


#编辑器sublime text 3
RUN add-apt-repository ppa:webupd8team/sublime-text-3

RUN apt-get update

RUN apt-get upgrade

RUN apt-get install -f


RUN apt-get install -y apt-utils vim git python3

#图形工具、翻墙工具蓝灯、截图软件shutter、压缩包、编辑器sublime text 3
EUN apt-get install unity-tweak-tool gdebi-core shutter rar sublime-text-installer

#chrome、蓝灯、输入法
RUN gdebi lantern-installer-beta-64-bit.deb google-chrome-stable_current_amd64.deb sogoupinyin.deb

RUN echo 'set number' > /root/.vimrc

# 安装mariadb,php环境
RUN echo 'mysql-server mysql-server/root_password password 123456' | debconf-set-selections && \ 
	echo 'mysql-server mysql-server/root_password_again password 123456' | debconf-set-selections && \
	apt-get install -y mariadb-server apache2 php php-mysql libapache2-mod-php php-gd
	
RUN	sed -i '/\[mysql\]/a default-character-set=utf8mb4' /etc/mysql/conf.d/mysql.cnf && \
	sed -i '/\[mysqld\]/a character_set_server=utf8mb4' /etc/mysql/mariadb.conf.d/50-server.cnf && \ 
	sed -i 's/bind-addres/#&/' /etc/mysql/mariadb.conf.d/50-server.cnf

RUN sed -i 's/#AddDefaultCharset/AddDefaultCharset/' /etc/apache2/conf-enabled/charset.conf
	
RUN service mysql start && mysql -u root -p123456 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION"

# 安装java、maven
RUN apt-get install -y openjdk-8-jdk maven

RUN sed -i '/<mirrors>/a <mirror><id>maven-aliyun</id><name>maven aliyun</name><url>http://maven.aliyun.com/nexus/content/groups/public</url><mirrorOf>central</mirrorOf></mirror> \
			<mirror><id>repo2</id><name>repo2 maven</name><url>http://repo2.maven.org/maven2/</url><mirrorOf>central</mirrorOf></mirror>' /etc/maven/settings.xml

WORKDIR /var/www/html

EXPOSE 80

EXPOSE 3306

ONBUILD RUN apt-get update

ENTRYPOINT service apache2 start ; service mysql start ; /bin/bash